﻿using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Collections.Specialized;
using Com.FastSearch.Esp.Search.Http;
using Com.FastSearch.Esp.Search.View;
        
namespace ESPWebPartsUnitTest.mock
{
    class ESPSearchFactoryMock: ISearchFactory
    {
        private Dictionary<string, SearchViewMock> views = new Dictionary<string, SearchViewMock>();

        public ESPSearchFactoryMock()
        {
            InitMock();
        }

        public ESPSearchFactoryMock(NameValueCollection properties)
        {
            InitMock();
        }

        private void InitMock()
        {
            views.Add("espsystemwebcluster", new SearchViewMock("espsystemwebcluster"));
            views.Add("viewmock1", new SearchViewMock("viewmock1"));
            views.Add("viewmock2", new SearchViewMock("viewmock2"));
        }

        public ISearchView GetSearchView(string name)
        {
            return views[name];            
        }

        

        public ISearchView GetSearchView(string name, bool reload)
        {
            return views[name];               
        }

        public ArrayList GetSearchViewList()
        {
            return new ArrayList(views.Keys);
            /*foreach (KeyValuePair<string, SearchViewMock> view in views)
            {
                array.Add(view.Key);
            }            
            return array;
             * */
        }

        public HttpSearchEngine GetSearchEngine(System.Uri url)
        {
            throw new System.NotImplementedException();
        }
    }
}
